package crm.service.impl;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import crm.dao.SourcesDao;
import crm.dao.impl.SourcesDaoImpl;
import crm.entity.Sources;
import crm.service.SourcesService;
import crm.utils.JdbcUtils;

public class SourcesServiceImpl implements SourcesService {

	private SourcesDao sourcesDao = new SourcesDaoImpl();
	
	public List<Sources> getSourcesList() throws InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException, SQLException {
		
		Connection connection = JdbcUtils.getConnection();
		
		String sql = "SELECT source_id as sourceID,source_name as sourceName FROM sources";
		
		List<Sources> sourcesList = sourcesDao.getSourcesList(connection, sql,Sources.class);
		
		return sourcesList;
	}

}
